<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('固定资产登记新增及修改')" />
    <style type="text/css">
        .layui-input, .layui-textarea{width:calc(100% - 100px);}
        .layui-form-label{width:180px}
        .layui-form-select dl{margin-left:80px;min-width: calc(100% - 100px);}
        .layui-edge{margin-right:28px;}
    </style>
</head>
<body>
<form class="layui-form" id="form" style="margin: 16px 84px 16px 25px;">
	<input type="hidden" id="guid" name="guid"  th:value="${fixedAssets?.guid}">
	<input type="hidden" id="cid" name="cid"  th:value="${fixedAssets?.cid}">
	<div class="layui-form-item">
        <label class="layui-form-label"><font class="f_red">*</font>序号：</label>
        <div class="layui-input-block">
            <input type="text" name="iid" id="iid" th:value="${fixedAssets?.iid}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><font class="f_red">*</font>所属公司/办公室：</label>
        <div class="layui-input-block">
            <input type="text" name="cidName" id="cidName" th:value="${fixedAssets?.cidName}" lay-verify="required" class="layui-input getMore_c" readonly>
            <i class="layui-icon layui-icon-more getMore_c" style="position: absolute;right: 35px;top: 9px;"></i>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><font class="f_red">*</font>编号：</label>
        <div class="layui-input-block">
            <input type="text" name="vid" id="vid" th:value="${fixedAssets?.vid}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><font class="f_red">*</font>固定资产名称：</label>   
        <div class="layui-input-block">
        	<input type="text" name="vGdZc" id="vGdZc" th:value="${fixedAssets?.vGdZc}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><font class="f_red">*</font>购入时间：</label>
        <div class="layui-input-block">
        	<input type="text" name="dGrSj" id="dGrSj" th:value="${fixedAssets?.dGrSj}" lay-verify="required" autocomplete="off" class="layui-input t_date" readonly>
           	<i class="dhicon dh-calendar" style="position: absolute;right: 35px;top: 9px;"></i>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">采购价格：</label>
        <div class="layui-input-block">
            <input type="text" name="fCgJe" id="fCgJe" th:value="${fixedAssets?.fCgJe}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><font class="f_red">*</font>采购数量：</label>
        <div class="layui-input-block">
            <input type="text" name="bNumb" id="bNumb" th:value="${fixedAssets?.bNumb}" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><font class="f_red">*</font>备注：</label>
        <div class="layui-input-block">
        	<textarea name="vBz" id="vBz" th:value="${fixedAssets?.vBz}" class="layui-textarea">[[${fixedAssets?.vBz}]]</textarea>
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit="" lay-filter="btn_save" id="btn_save" value="保存">
    </div>
</form>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    /*<![CDATA[*/
    var prefix = ctx + "oa/fixedassets";
    /*]]>*/
</script>
<script>
var $,layer,form,laydate;
layui.use(['form','layer','jquery','laydate'], function () {
    $ = layui.$,layer = layui.layer,form = layui.form,laydate=layui.laydate;
    laydate.render({elem:'#dGrSj',type:'datetime',trigger:'click'});
    form.render();
});
//公司选择
$('.getMore_c').on('click', function () {
	$.modal.open('选择公司/办公室','/base/company/select','925','500',function(index){
        var res = window["layui-layer-iframe" + index].callbackdata();
        if(res=='none'){
        	$('#cid').val('');
        	$('#cidName').val('');
        	layer.close(index);
        }else{
        	$('#cid').val(res.vId);
        	$('#cidName').val(res.vName);
        	layer.close(index);
        }
    });
});
//提交调用的方法
function submitHandler() {
	if($('#guid').val()){//通过判断guid是否存在来判断是新增还是保存
		if ($.validate.form()) {
            $.operate.save(prefix + "/editpost", {'fixedAssetsItems':JSON.stringify([$.common.formToJSON('form')])});
        }
	}else{
		if ($.validate.form()) {
			$.operate.save(prefix + "/addpost", {'fixedAssetsItems':JSON.stringify([$.common.formToJSON('form')])});
		}
	}
}
</script>
</body>
</html>
